<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title></title>
  <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
  <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css">
  <link rel="stylesheet" href="/static/mobile/weuix.css">
  <link rel="stylesheet" href="/static/mobile/css.css">
  <link rel="stylesheet" href="/static/mobile/iconfont.css">
  <style>
    .content {
      margin-top: 50px;
    }

  </style>
</head>
<body>
<section id="content">
  <div class="header">
    <div class="weui-flex">
      <div class="weui-flex__item">
        <div class="placeholder" style="width: 25%;">
          <a href="javascript:window.history.back();" class="fanhui">
            <i class="iconfont icon---" style="float: left; margin-left: 10px;"></i>
          </a>
        </div>
      </div>
      <div class="weui-flex__item"><span class="page-header">公告</span></div>
      <div class="weui-flex__item">
        <div class="placeholder"></div>
      </div>
    </div>
  </div>
  <div class="weui-content" style="padding-bottom: 64px">
    <div class="weui-c-inner">
      <div class="weui-c-content">
        <h2 class="weui-c-title">{{article.title}}</h2>
        <div class="weui-c-meta">
          <span class="weui-c-nickname"><a href="javascript:;">{{article.realname}}</a></span>
          <em class="weui-c-nickname">{{article.create_time}}</em>
        </div>
        <div class="weui-c-article" v-html="article.content"></div>
      </div>
    </div>
    <a href="javascript:;" class="weui-btn weui-btn_warn" style="margin-top: 20px;"
       v-show="!article.readtime"
       @click="confirmRead">确认已读</a>
  </div>
  <div id="footer"></div>
</section>

<script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/jquery-weui.min.js"></script>
<script src="https://cdn.bootcss.com/vue/2.2.1/vue.min.js"></script>
<script src="/static/mobile/main.js"></script>

<script>
  $("#footer").load('footer.html');
  var conent = new Vue({
    el: "#content",
    data: {
      article: {},
      id: urlTools.getUrlParam("id"),
    },
    mounted: function () {
      var that = this;
      var id = this.id;
      $("#footer").load('footer.html');

      js_request('/portal/notice/view', {id: id}, function (result) {
        if (result.code == 0) {
          $.toast(result.msg, "forbidden");
          return false;
        }
        that.article = result.data;
      });
    },
    watch: {},
    methods: {
      confirmRead: function () {
        var that = this;
        var id = this.id;
        js_request('/portal/notice/read', {id: id}, function (result) {
          if (result.code == 0) {
            $.toast(result.msg, "公告");
            return false;
          }
          js_alert("您已确认知悉该内容", "公告", function () {
            window.location.href="my.html";
          });
        });

      },
    },
  });
</script>
</body>
</html>